<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>客户经理信息列表</title>
<link href="<%=basePath %>css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath %>js/jquery.js"></script>
<script type="text/javascript">
function confirmMsgDel()
{  
	var ids="";
    var $chkBoxes = $('#clientMgrTable').find('input:checked');   //找到被选中的checkbox集
    if ($chkBoxes.length == 0) {         //如果不勾选弹出警告框
      alert('请至少选择一个数据集');
      return false;
    }
     //遍历被选中的checkbox集
    $($chkBoxes).each(function () { 
      ids +=$(this).attr('data-id')+",";
    })
    ids = ids.substr(0,ids.length-1);
	if (confirm("您确定要删除选中的用户信息吗?"))
		 window.location="<%=basePath%>deleteMgr?mgrId="+ids; 
} 
function exportMsg()
{  
   var unitVal = $("#unit").val();
   var mgrIdVal = $("#mgrId").val();
   var cnameVal = $("#cname").val();
   alert(unitVal);
   alert(mgrIdVal);
   alert(cnameVal);
   if(confirm("您确定要导出吗?"))
	   
     window.location.href = "<%=basePath%>exportExcel?unit="+unitVal+"&mgrId="+mgrIdVal+"&cname="+cnameVal;
     
} 
function deleteMgr(mgrId){
	 if(confirm("删除客户经理信息,您确定要删除吗?")){
		 window.location="<%=basePath%>deleteMgr?mgrId="+mgrId;
	 }
}
</script>
<script type="text/javascript">
$(document).ready(function(){
	  $(".click").click(function(){
	  $(".tip").fadeIn(200);
	  });
	  
	  $(".tiptop a").click(function(){
	  $(".tip").fadeOut(200);
	});

	  $(".sure").click(function(){
	  $(".tip").fadeOut(100);
	});

	  $(".cancel").click(function(){
	  $(".tip").fadeOut(100);
	});

	});
</script>
</head>
<body>
  <div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">客户经理信息综合管理维护</a></li>
    </ul>
    </div>
	<form action="<%=basePath %>clientMgrList" method="post">
	 <div class="formbody">
	    <ul class="seachform">
	    <li><label>机构</label><input name="unit" id="unit" type="text" class="scinput"  value="${unit }"/></li>
	    <li><label>客户经理编号</label><input name="mgrId" id="mgrId" type="text" class="scinput" value="${mgrId }"/></li>
	    <li><label>姓名</label><input name="cname" id="cname" type="text" class="scinput" value="${cname }"/></li>
	    <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
	    </ul>
	</div>

    <div class="rightinfo">
	    <div class="tools">
	    	<ul class="toolbar1">
	    	 <li><a href="<%=basePath %>toMgrAdd"><span><img src="<%=basePath %>images/t01.png" /></span>添加</a></li>
	        <li><a href="clientMgrUpdate.html"><span><img src="<%=basePath %>images/t02.png" /></span>修改</a></li>
	        <li><a href="javascript:confirmMsgDel()" ><span><img src="<%=basePath %>images/t03.png"/></span>删除</a></li>
	        <li><a href="javascript:exportMsg()" ><span><img src="<%=basePath %>images/t06.png"  height="24" width="20"/></span>导出</a></li>
	        </ul>
	    </div>
	    <table class="tablelist" id="clientMgrTable">
	    	<thead>
		    	<tr class="tablehead"><td colspan="10">客户经理信息列表</td></tr>
		    	</thead>
		    	<thead>
		    	<tr>
		        <th>选择</th>
		        <th>客户经理编号</th>
		        <th>姓名</th>
		        <th>性别</th>
		        <th>身份证号</th>
		        <th>出生日期</th>
		        <th>客户经理等级</th>
		        <th>机构</th>
		        <th>部门</th>
		        <th>操作</th>
		        </tr>
	        </thead>
	        <tbody>
	         <c:forEach items="${pageInfo.list}" var="mgr">
		        <tr>
		        <td><input name="mgr_ids"  data-id="${mgr.userId }" type="checkbox" value="${mgr.userId }" /></td>
		        <td>${mgr.userId }</td>
		        <td>${mgr.userName }</td>
		         <td>
			        <c:if test="${mgr.sex =='F'}">
			                            女
			        </c:if>
			        <c:if test="${mgr.sex == 'M'}">
			                            男
			        </c:if>
		        </td>
		         <td>${mgr.IDCard }</td>
		         
		         <td><fmt:formatDate type="date" value="${mgr.birthday }" /></td> 
		        <td>
		           <c:forEach items="${mgrLevel}" var="itemtype">
					    <c:if test="${mgr.level eq itemtype.key}">
			               ${itemtype.value }
			            </c:if>
			       </c:forEach>
		        </td>
		        <td>${mgr.unit }</td>
		        <td>${mgr.dept }</td>
		         <td><a href="<%=basePath %>clientMgrInfo?mgrId=${mgr.userId }" class="tablelink">查看</a> 
		             <a href="javascript:deleteMgr('${mgr.userId }')" class="tablelink"> 删除</a>
		        </td>
		        </tr> 
		       </c:forEach>
	        </tbody>
	    </table>
		<div class="pagin">
	 		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	          <tr>
	            <td class="STYLE4"><div class="message">共<i class="blue">${pageInfo.total}</i>条记录，当前显示第&nbsp;<i class="blue">${pageInfo.pageNum}&nbsp;</i>页
	            共<i class="blue">${pageInfo.pages}&nbsp;</i>页</div>
	           </td>
	            <td><table border="0" align="right" cellpadding="0" cellspacing="0">
	                <tr>
	                   <td width="45">
	                     <a href="<%=basePath %>clientMgrList?pn=1" >首页</a>
	                  </td> 
	                  <td width="50">
	                     <a href="<%=basePath %>clientMgrList?pn=${pageInfo.pageNum-1}">上一页</a>
	                  </td>
	                  <td width="50">
	                     <a href="<%=basePath %>clientMgrList?pn=${pageInfo.pageNum+1}">下一页</a>
	                  </td>
	                   <td width="50">
	                     <a href="<%=basePath %>clientMgrList?pn=${pageInfo.pages}">尾页</a>
	                  </td>
	                  <td width="100"><div align="center"><span class="STYLE1">转到第
	                    <input name="selectPage" id="selectPage" type="text" size="4" style="height:16px; width:35px; border:1px solid #999999;" /> 
	                    页 </span></div></td>
	                  <td width="40">
	                  <img src="<%=basePath %>images/go.gif" width="33" height="17" style="cursor:hand" onclick="goPage()"/>
	                  </td>
	                </tr>
	            </table>
	            </td>
	            </tr>
	            </table>
			</div> 
	</div>
    </form>
    
    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	function goPage(){
		var pn = $("#selectPage").val();
		window.location="<%=basePath %>manager/clientMgrList.action?pn="+pn;
		
	}
	</script>
</body>
</html>